<?
session_start();
$pagename=LA_ADD_AD;
include_once("header_inc.php");
$tplPur=new TplLoad;
check_valid_user("");
include_once("member_header.php");	

$valid_user = $_SESSION["valid_user"];

$sql = "select * from $pay_tbl where o_user='" . $_SESSION["valid_user"] . "' AND (o_status='Paid' or o_vendor=98 or o_vendor=999) order by o_date desc limit 10";
$res_1 = q($sql);
$i=0;
while ($row = mysql_fetch_array($res_1))
{
	 	
 	$sql = "select * from $pkg_tbl where pid=" . $row["o_package"];
	$res=q($sql);
	$row_pkg = mysql_fetch_array($res);
	$pkg_name=$row_pkg["pname"];	
	$o_vendor=$row["o_vendor"];	
	$o_status=$row["o_status"];	
	
	if ($o_status)
		$o_status="($o_status)";
		
	if ($o_vendor==98)
		$o_vendor="Check/Bank";
		
	if ($o_vendor==999)
		$o_vendor="Manual";

	
	
	$lOrderArray[$i]["pkg_name"]=$pkg_name;
	$lOrderArray[$i]["date_paid"]=formatDateShort($row["o_date_paid"]);
	$lOrderArray[$i]["date_order"]=formatDateShort($row["o_date"]);
	$lOrderArray[$i]["price"]=$row["o_amount"];
	$lOrderArray[$i]["vendor"]=$row["o_vendor"];
	$lOrderArray[$i]["status"]=$row["o_status"];
	$lOrderArray[$i]["currency"]=$row_pkg["pcurrency"];
	$i++;
}
$tplPur->assign("orderlist",$lOrderArray);

$tplPur->assign("email",$from);
$tplPur->assign("name",$name);
$tplPur->assign("number",$number);
$tplPur->assign("num_contacted","$num_contacted");
$tplPur->assign("number_sold",$number_sold);
$tplPur->assign("number_hits",$number_hits);
$tplPur->assign("cur_grade",$cur_grade);
$tplPur->assign("score",$score);
$tplPur->assign("credits",$credits);
$tplPur->assign("credits_option",$credits_option);

$tplPur->display("member_orders.tpl");


include_once("member_footer.php");
include_once("footer_inc.php");
?>